package com.dgut.usermanager.service;

import com.dgut.usermanager.dao.HouseDao;
import com.dgut.usermanager.entity.House;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class HouseServiceImp implements HouseService{

    @Autowired
    HouseDao houseDao;

    public HouseServiceImp() {
        super();
    }

    @Override
    public House findHouseByUserId(Integer userId) {
        return houseDao.findHousesByUserId(userId);
    }

    @Override
    public House AddHouse(House house) {
        return houseDao.save(house);
    }

    @Override
    public House updateHouse(House house) {
        return houseDao.save(house);
    }

    @Override
    public void deleteHouseByUserId(Integer userId) {
        houseDao.deleteImageByUserId(userId);
    }
}
